
#ifndef IDictionary_t_h
#define IDictionary_t_h

//#include <sstream>

#include <Typedef.h>
#include <Defines.h>
#include <CSharpPropertyMethods.h>

#include "System/Object.h"
#include "System/String.h"
#include "System/Collections/Generic/ICollection.h"
#include "System/Collections/Generic/IEnumerable.h"

namespace Riccsson
{
	namespace System
	{
		namespace Collections
		{
			namespace Generic
			{
				// Summary:
				//     Defines a key/value pair that can be set or retrieved.
				//
				// Type parameters:
				//   TKey:
				//     The type of the key.
				//
				//   TValue:
				//     The type of the value.
				template<typename TKey,typename  TValue> struct KeyValuePair : public Object
				{
					
					private: TKey _Key;
					private: TValue _Value;

					// Summary:
					//     Gets the key in the key/value pair.
					//
					// Returns:
					//     A TKey that is the key of the System.Collections.Generic.KeyValuePair<TKey,TValue>.
					public: PROP3GET_DEF(KeyValuePair, TKey, Key)

					//
					// Summary:
					//     Gets the value in the key/value pair.
					//
					// Returns:
					//     A TValue that is the value of the System.Collections.Generic.KeyValuePair<TKey,TValue>.
					public: PROP3GET_DEF(KeyValuePair, TValue, Value)

					//
					// Summary:
					//     Initializes a new instance of the System.Collections.Generic.KeyValuePair<TKey,TValue>
					//     structure with the specified key and value.
					//
					// Parameters:
					//   key:
					//     The object defined in each key/value pair.
					//
					//   value:
					//     The definition associated with key.
					public: KeyValuePair(TKey key, TValue value)
						: PROP3GET_INIT(KeyValuePair, Key)
						, PROP3GET_INIT(KeyValuePair, Value)
						, _Key( key )
						, _Value( value )
					{
					}

					public: KeyValuePair()
						: PROP3GET_INIT(KeyValuePair, Key)
						, PROP3GET_INIT(KeyValuePair, Value)
						, _Key( 0 )
						, _Value( 0 )
					{
					}

					COPY_CONSTRUCTOR(KeyValuePair<TKey COMMA TValue>)
					{
						PROP3GET_INIT_COPY(KeyValuePair, TKey, Key);
						PROP3GET_INIT_COPY(KeyValuePair, TValue, Value);
						_Key = other._Key;
						_Value = other._Value;
					}
							
					public: PROP3_GET(TKey, Key)
					{
						return _Key;
					}
	
					public: PROP3_GET(TValue, Value)
					{
						return _Value;
					}

					// Summary:
					//     Returns a string representation of the System.Collections.Generic.KeyValuePair<TKey,TValue>,
					//     using the string representations of the key and value.
					//
					// Returns:
					//     A string representation of the System.Collections.Generic.KeyValuePair<TKey,TValue>,
					//     which includes the string representations of the key and value.
					public: override GC_PTR<string> ToString()
					{
						Object outKey;
						Object outValue;
						GC_PTR<String> result( new String("") );
						/*
						std::stringstream stream;
						if(instanceof_cast(outKey, _Key, Object)){
							stream << outKey.toString();
						}
						else{
							stream << _Key;
						}
						if(instanceof_cast(outValue, _Value, Object)){
							stream << outValue.toString();
						}
						else{
							stream << _Value;
						}
						stream >> result;
						*/
						throw;
						return result;
					}

				};

				// Summary:
				//     Represents a generic collection of key/value pairs.
				//
				// Type parameters:
				//   TKey:
				//     The type of keys in the dictionary.
				//
				//   TValue:
				//     The type of values in the dictionary.
				template<typename TKey, typename TValue> interface IDictionary
					: public ICollection<KeyValuePair<TKey, TValue>>
					//, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
				{
					
					protected: GC_PTR<ICollection<TKey>> _PROP_Keys; public: Property_Get<IDictionary<TKey, TValue>, GC_PTR<ICollection<TKey>> > Keys;
					protected: GC_PTR<ICollection<TValue>> _PROP_Values; public: Property_Get<IDictionary<TKey, TValue>, GC_PTR<ICollection<TValue>> > Values;
					
					//PROP3GET(IDictionary<TKey COMMA TValue>, GC_PTR<ICollection<TKey>>, Keys)
					//PROP3GET(IDictionary<TKey COMMA TValue>, GC_PTR<ICollection<TValue>>, Values)
					
					// Summary:
					//     Gets an System.Collections.Generic.ICollection<T> containing the keys of
					//     the System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					// Returns:
					//     An System.Collections.Generic.ICollection<T> containing the keys of the object
					//     that implements System.Collections.Generic.IDictionary<TKey,TValue>.
					public: virtual PROP3_GET(GC_PTR<ICollection<TKey>>, Keys) = 0;
							
					//
					// Summary:
					//     Gets an System.Collections.Generic.ICollection<T> containing the values in
					//     the System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					// Returns:
					//     An System.Collections.Generic.ICollection<T> containing the values in the
					//     object that implements System.Collections.Generic.IDictionary<TKey,TValue>.
					public: virtual PROP3_GET(GC_PTR<ICollection<TValue>>, Values) = 0;
				
					public: IDictionary()
						: PROP3GET_INIT(IDictionary<TKey COMMA TValue>, Keys)
						, PROP3GET_INIT(IDictionary<TKey COMMA TValue>, Values)
					{
					}

					// Summary:
					//     Gets or sets the element with the specified key.
					//
					// Parameters:
					//   key:
					//     The key of the element to get or set.
					//
					// Returns:
					//     The element with the specified key.
					//
					// Exceptions:
					//   System.ArgumentNullException:
					//     key is null.
					//
					//   System.Collections.Generic.KeyNotFoundException:
					//     The property is retrieved and key is not found.
					//
					//   System.NotSupportedException:
					//     The property is set and the System.Collections.Generic.IDictionary<TKey,TValue>
					//     is read-only.
					public: virtual TValue& operator[](TKey key) = 0;

					// Summary:
					//     Adds an element with the provided key and value to the System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					// Parameters:
					//   key:
					//     The object to use as the key of the element to add.
					//
					//   value:
					//     The object to use as the value of the element to add.
					//
					// Exceptions:
					//   System.ArgumentNullException:
					//     key is null.
					//
					//   System.ArgumentException:
					//     An element with the same key already exists in the System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					//   System.NotSupportedException:
					//     The System.Collections.Generic.IDictionary<TKey,TValue> is read-only.
					public: virtual void Add(const TKey& key, const TValue& value) = 0;

					//
					// Summary:
					//     Determines whether the System.Collections.Generic.IDictionary<TKey,TValue>
					//     contains an element with the specified key.
					//
					// Parameters:
					//   key:
					//     The key to locate in the System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					// Returns:
					//     true if the System.Collections.Generic.IDictionary<TKey,TValue> contains
					//     an element with the key; otherwise, false.
					//
					// Exceptions:
					//   System.ArgumentNullException:
					//     key is null.
					public: virtual bool ContainsKey(const TKey& key) = 0;

					//
					// Summary:
					//     Removes the element with the specified key from the System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					// Parameters:
					//   key:
					//     The key of the element to remove.
					//
					// Returns:
					//     true if the element is successfully removed; otherwise, false. This method
					//     also returns false if key was not found in the original System.Collections.Generic.IDictionary<TKey,TValue>.
					//
					// Exceptions:
					//   System.ArgumentNullException:
					//     key is null.
					//
					//   System.NotSupportedException:
					//     The System.Collections.Generic.IDictionary<TKey,TValue> is read-only.
					public: virtual bool Remove(const TKey& key) = 0;

					//
					// Summary:
					//     Gets the value associated with the specified key.
					//
					// Parameters:
					//   key:
					//     The key whose value to get.
					//
					//   value:
					//     When this method returns, the value associated with the specified key, if
					//     the key is found; otherwise, the default value for the type of the value
					//     parameter. This parameter is passed uninitialized.
					//
					// Returns:
					//     true if the object that implements System.Collections.Generic.IDictionary<TKey,TValue>
					//     contains an element with the specified key; otherwise, false.
					//
					// Exceptions:
					//   System.ArgumentNullException:
					//     key is null.
					public: virtual bool TryGetValue(const TKey& key, TValue out value) = 0;
				};
			}
		}
	}
}

#endif // IDICTIONARY_H